<?php
    header("content-type:text/html;charset=utf8");

    $username = $_POST["username"];
    $phone = $_POST["phone"];

    // 链接
    $link = mysql_connect("localhost","root","root");
    mysql_query("set names utf8");

    // 选择
    mysql_select_db("test");

    // 编写sql
    $sql = "SELECT * FROM `userlist` WHERE `username`='$username' AND `phone`='$phone'";

    // 执行sql：注意$res是只要sql能正常执行就会返回true，所以不能作为判断条件
    $res = mysql_query($sql);
    $arr = mysql_fetch_array($res);

    // echo json_encode($arr);

    if($arr){
        echo 1;
    }else{
        echo 0;
    }

    // 关闭
    mysql_close($link);    
?>